extends "../edu-1/edu-1.gd"

func _extInit():
	._extInit()
	lv = 2
	addSkill("每{cd}秒对雷击最高的敌人造成[雷击+目标雷击]的技能伤害，并降低其40%雷击", "嫉妒", "jiDu", 7)

var p2 = 1
func _castCdSkill(id):
	._castCdSkill(id)
	if id == "jiDu":
		jiDu()

func jiDu(cha = null):
	if cha == null:
		var chas = getAllChas(1)
		chas.sort_custom(sys,"sortByMgiAtkDesc")
		if not chas.empty():
			cha = chas[0]
	createFlyEff(sprcPos, cha, "sk_4_1_2")	
	azurHurtChara(cha, cha.att.mgiAtk + att.mgiAtk, sys.HurtType.WEAPON, sys.AtkType.SKILL, "嫉妒", false, p2)
	if cha.isDeath:return
	if cha.hasBuff("b_edu") == null:
		castBuff(cha, b_edu.new(4))
	if upgraded == 2:
		castBuff(cha, buff.b_zhuoShao.new(3))	

class b_edu:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	func _init(num = 5, dis = 1):
		attInit()
		id = "b_edu"	
		isNegetive = true
		att.mgiAtkL = -0.1*num
		dispel = dis
		buffName = "嫉妒"
	func _connect():
		if casCha.lv == 3:
			buff.addJuDu(masCha, casCha, 5)